package com.example.moduletwo.adapter.binder;

import android.text.TextUtils;
import com.example.moduletwo.adapter.delegate.TestTwoAdapterDelegate2;
import com.example.mvp.binder.BaseDataBinder;

/**
 * 数据视图绑定（数据驱动视图有延迟刷新）
 * Created by sun.li on 2018/6/5.
 *
 * @author sun.li
 */

public class TestTwoAdapterBinder2 implements BaseDataBinder<TestTwoAdapterDelegate2, String> {

    @Override
    public void viewBindModel(TestTwoAdapterDelegate2 viewDelegate, String data) {
        if (null == data || null == viewDelegate) {
            return;
        }
//        if(!TextUtils.isEmpty(data)){
//            viewDelegate.setText(data);
//        }
        strBindView(viewDelegate, data);
    }

    @Override
    public Class<String> getDataClass() {
        return String.class;
    }

    /**
     * 数据对象1业务处理
     */
    private void strBindView(final TestTwoAdapterDelegate2 viewDelegate, final String str) {
        if (!TextUtils.isEmpty(str)) {
            viewDelegate.setText(str+"_two");
        }
    }


}
